// 显示平台统计数据   (柱状图)
function showPlatStaticsDataEcharts(hist) {
    let x = [];
    let y = [];
    for (let i = 0; i < hist.length; i++) {
        x.push(hist[i].platname)
        y.push(hist[i].platcount)
    }
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option = {
        xAxis: {
            type: 'category',
            data: x
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: y,
            type: 'bar',
            showBackground: true,
            backgroundStyle: {
                color: 'rgba(180, 180, 180, 0.2)'
            }
        }]
    };
    option && myChart.setOption(option);
}

// 显示平台统计数据   (饼状图)
function showPlatStaticsDatapieEcharts(pie) {
    let arr = [];
    for (let i = 0; i < pie.length; i++) {
        let obj = {
            value: pie[i].platcount,
            name: pie[i].platname
        }
        arr.push(obj)
    }
    var chartDom = document.getElementById('app');
    var myChart = echarts.init(chartDom);
    let option = {
        title: {
            text: '约见平台',
            left: 'center'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            orient: 'vertical',
            left: 'left',
        },
        series: [{
            name: '访问来源',
            type: 'pie',
            radius: '50%',
            data: arr,
            emphasis: {
                itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }]
    };

    option && myChart.setOption(option);
}

// 显示平台统计数据   (折线图)
function showQuestStaticsDataEcharts(chart) {
    console.log(chart);
    let x = [];
    for (let i = 0; i < chart.length; i++) {
        x.push(i);
    }
    console.log(x);
    let chartDom = document.getElementById('line');
    let myChart = echarts.init(chartDom);
    var option = {
        xAxis: {
            type: 'category',
            data: x
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: chart,
            type: 'line'
        }]
    };
    option && myChart.setOption(option);
}